package zl.ioc_and_factory;
/**
 * @author  SuperZL 
 * @version 2012-8-29 下午3:39:22
 * 动物工厂类、用来生成动物对象
 */
public class AnimalFactory2 {
	
	public static Animal createAnimal(String name){
		Animal animal = null;
		try {
			animal = (Animal) Class.forName(name).newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return animal;
	}
}
